<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace vipapis\xstore\cc\transferring\api;

class TransferOutItem {
	
	static $_TSPEC;
	public $txId = null;
	public $barcode = null;
	public $purchaseNo = null;
	public $outPurchaseNo = null;
	public $deliveredQuantity = null;
	public $containerNo = null;
	public $grade = null;
	public $sellStatus = null;
	public $thirdTransportNo = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			1 => array(
			'var' => 'txId'
			),
			2 => array(
			'var' => 'barcode'
			),
			3 => array(
			'var' => 'purchaseNo'
			),
			4 => array(
			'var' => 'outPurchaseNo'
			),
			5 => array(
			'var' => 'deliveredQuantity'
			),
			6 => array(
			'var' => 'containerNo'
			),
			7 => array(
			'var' => 'grade'
			),
			8 => array(
			'var' => 'sellStatus'
			),
			9 => array(
			'var' => 'thirdTransportNo'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['txId'])){
				
				$this->txId = $vals['txId'];
			}
			
			
			if (isset($vals['barcode'])){
				
				$this->barcode = $vals['barcode'];
			}
			
			
			if (isset($vals['purchaseNo'])){
				
				$this->purchaseNo = $vals['purchaseNo'];
			}
			
			
			if (isset($vals['outPurchaseNo'])){
				
				$this->outPurchaseNo = $vals['outPurchaseNo'];
			}
			
			
			if (isset($vals['deliveredQuantity'])){
				
				$this->deliveredQuantity = $vals['deliveredQuantity'];
			}
			
			
			if (isset($vals['containerNo'])){
				
				$this->containerNo = $vals['containerNo'];
			}
			
			
			if (isset($vals['grade'])){
				
				$this->grade = $vals['grade'];
			}
			
			
			if (isset($vals['sellStatus'])){
				
				$this->sellStatus = $vals['sellStatus'];
			}
			
			
			if (isset($vals['thirdTransportNo'])){
				
				$this->thirdTransportNo = $vals['thirdTransportNo'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'TransferOutItem';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("txId" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->txId);
				
			}
			
			
			
			
			if ("barcode" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->barcode);
				
			}
			
			
			
			
			if ("purchaseNo" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->purchaseNo);
				
			}
			
			
			
			
			if ("outPurchaseNo" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->outPurchaseNo);
				
			}
			
			
			
			
			if ("deliveredQuantity" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->deliveredQuantity);
				
			}
			
			
			
			
			if ("containerNo" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->containerNo);
				
			}
			
			
			
			
			if ("grade" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->grade);
				
			}
			
			
			
			
			if ("sellStatus" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->sellStatus); 
				
			}
			
			
			
			
			if ("thirdTransportNo" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->thirdTransportNo);
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		$xfer += $output->writeFieldBegin('txId');
		$xfer += $output->writeString($this->txId);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('barcode');
		$xfer += $output->writeString($this->barcode);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('purchaseNo');
		$xfer += $output->writeString($this->purchaseNo);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('outPurchaseNo');
		$xfer += $output->writeString($this->outPurchaseNo);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('deliveredQuantity');
		$xfer += $output->writeString($this->deliveredQuantity);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->containerNo !== null) {
			
			$xfer += $output->writeFieldBegin('containerNo');
			$xfer += $output->writeString($this->containerNo);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->grade !== null) {
			
			$xfer += $output->writeFieldBegin('grade');
			$xfer += $output->writeString($this->grade);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->sellStatus !== null) {
			
			$xfer += $output->writeFieldBegin('sellStatus');
			$xfer += $output->writeI32($this->sellStatus);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->thirdTransportNo !== null) {
			
			$xfer += $output->writeFieldBegin('thirdTransportNo');
			$xfer += $output->writeString($this->thirdTransportNo);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>